Tegra: support to compile native GICv2 drivers
authorVarun Wadekar <[email protected]>
Fri, 19 Oct 2018 18:44:31 +0000 (11:44 -0700)
committerVarun Wadekar <[email protected]>
Tue, 18 Dec 2018 21:24:52 +0000 (13:24 -0800)
This patch adds a macro to allow platforms to compile native
GICv2 drivers along with Tegra handlers.

Change-Id: I8281796c09dae5704cff2daab831395d65e261b7
Signed-off-by: Varun Wadekar <[email protected]>
plat/nvidia/tegra/common/tegra_common.mk
plat/nvidia/tegra/common/tegra_gicv2.c [new file with mode: 0644]

index abb9bb814030774acb432234d5992fcf04dc550c..6469f75101fa13293536841984ff9ae06deb624e 100644 (file)
@@ -13,7 +13,13 @@ PLAT_BL_COMMON_SOURCES       +=      ${XLAT_TABLES_LIB_SRCS}
 
 COMMON_DIR             :=      plat/nvidia/tegra/common
 
-BL31_SOURCES           +=      drivers/console/aarch64/console.S               \
+TEGRA_GICv2_SOURCES    :=      drivers/arm/gic/common/gic_common.c             \
+                               drivers/arm/gic/v2/gicv2_main.c                 \
+                               drivers/arm/gic/v2/gicv2_helpers.c              \
+                               plat/common/plat_gicv2.c                        \
+                               ${COMMON_DIR}/tegra_gicv2.c
+
+BL31_SOURCES           +=      drivers/console/aarch64/console.S               \
                                drivers/delay_timer/delay_timer.c               \
                                drivers/ti/uart/aarch64/16550_console.S         \
                                ${COMMON_DIR}/aarch64/tegra_helpers.S           \
diff --git a/plat/nvidia/tegra/common/tegra_gicv2.c b/plat/nvidia/tegra/common/tegra_gicv2.c
new file mode 100644 (file)
index 0000000..6ccbd15
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+#include <bl_common.h>
+#include <gicv2.h>
+#include <platform_def.h>
+#include <tegra_private.h>
+#include <tegra_def.h>
+#include <utils.h>
+
+/******************************************************************************
+ * Tegra common helper to setup the GICv2 driver data.
+ *****************************************************************************/
+void tegra_gic_setup(tegra_gic_cfg_t *cfg)
+{
+       /*
+        * Tegra GIC configuration settings
+        */
+       static gicv2_driver_data_t tegra_gic_data;
+
+       /*
+        * Register Tegra GICv2 driver
+        */
+       tegra_gic_data.gicd_base = TEGRA_GICD_BASE;
+       tegra_gic_data.gicc_base = TEGRA_GICC_BASE;
+       tegra_gic_data.g0_interrupt_num = cfg->g0_int_num;
+       tegra_gic_data.g0_interrupt_array = cfg->g0_int_array;
+       gicv2_driver_init(&tegra_gic_data);
+}
+
+/******************************************************************************
+ * Tegra common helper to initialize the GICv2 only driver.
+ *****************************************************************************/
+void tegra_gic_init(void)
+{
+       gicv2_distif_init();
+       gicv2_pcpu_distif_init();
+       gicv2_cpuif_enable();
+}
+
+/******************************************************************************
+ * Tegra common helper to disable the GICv2 CPU interface
+ *****************************************************************************/
+void tegra_gic_cpuif_deactivate(void)
+{
+       gicv2_cpuif_disable();
+}
+
+/******************************************************************************
+ * Tegra common helper to initialize the per cpu distributor interface
+ * in GICv2
+ *****************************************************************************/
+void tegra_gic_pcpu_init(void)
+{
+       gicv2_pcpu_distif_init();
+       gicv2_cpuif_enable();
+}